<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="Mosaddek">
<meta name="keyword"
	content="FlatLab, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
<link rel="shortcut icon"
	href="/rucdbcourse/views/images/ruc_logo_icon.jpg">
<title>数据库系统概论实验评分系统</title>
<link href="/rucdbcourse/views/css/micpback.css" rel="stylesheet">
<!-- Bootstrap core CSS -->
<link href="/rucdbcourse/views/css/bootstrap.min.css" rel="stylesheet">
<link href="/rucdbcourse/views/css/bootstrap-reset.css" rel="stylesheet">
<!--external css-->
<link href="/rucdbcourse/views/assets/font-awesome/css/font-awesome.css"
	rel="stylesheet" />
<link
	href="/rucdbcourse/views/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css"
	rel="stylesheet" type="text/css" media="screen" />
<link rel="stylesheet" href="/rucdbcourse/views/css/owl.carousel.css"
	type="text/css">
<!-- Custom styles for this template -->
<link href="/rucdbcourse/views/css/style.css" rel="stylesheet">
<link href="/rucdbcourse/views/css/style-responsive.css"
	rel="stylesheet" />
<link rel="stylesheet" media="screen"
	href="/rucdbcourse/views/css/zzsc.css" />
<link rel="stylesheet" media="screen"
	href="/rucdbcourse/views/css/loading-bar.css" />
<!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
<!--[if lt IE 9]>
      <script src="js/html5shiv.js"></script>
      <script src="js/respond.min.js"></script>
    <![endif]-->
<style>
/*
	 * override the default CSS as an example
	 */
#loading-bar .bar {
	background: #C43C3C;
}

#loading-bar-spinner .spinner-icon {
	border-top-color: #C43C3C;
	border-left-color: #C43C3C;
}

a:link {
	color: #000000
}

a:visited {
	color: #000000
}

a:hover {
	color: #B8B8B8
}

a:active {
	color: #B8B8B8
}

#loading-bar .peg {
	-moz-box-shadow: #C43C3C 1px 0 6px 1px;
	-ms-box-shadow: #C43C3C 1px 0 6px 1px;
	-webkit-box-shadow: #C43C3C 1px 0 6px 1px;
	box-shadow: #C43C3C 1px 0 6px 1px;
}
</style>
</head>

<body>
	<div ng-app="index" ng-controller="indexCtrl">
		<header class="header white-bg" style="width: 83%">
			<div class="sidebar-toggle-box">
				<div data-original-title="Toggle Navigation" data-placement="right"
					class="icon-reorder tooltips" id="toggle-sidebar"></div>
			</div>
			<div class="top-nav ">
				<!--search & user info start-->
				<ul class="nav pull-right top-menu" style="margin-top: 10px">
					<i class="icon-key"></i>
					<a href="/rucdbcourse/user/logout"><span>退出登录</span></a>
					<!-- user login dropdown end -->
				</ul>
				<!--search & user info end-->
			</div>
		</header>
		<!--header end-->
		<!--sidebar start-->
		<aside>
			<div id="sidebar" class="nav-collapse " style="width: 17%">
				<!-- sidebar menu start-->
				<ul class="sidebar-menu">
					<div class="welcome">
						<img src="/rucdbcourse/views/images/2.jpg"
							class="img-circle pull-left">
						<p class="text-center">
							<br> <b>WELCOME</b> <br> <span id="name">{{userName}}<br></span>
						</p>
					</div>
					<li class=""><a class="" href="/rucdbcourse/views/index.html">
							<i class="icon-home"></i> <span style="padding-left: 2px">首页</span>
					</a></li>
					<li class="" ng-click="feedbackClick()"><a class="" href="">
							<i class="icon-home"></i> <span style="padding-left: 2px">反馈</span>
					</a></li>
					<p ng-init="constmoduleid=0" ng-model="constmoduleid"></p>
					<li class="sub-menu" ng-repeat="module in modules"
						id="a{{module.MODULEID}}" ng-if="module.M_PARENT == -1"><a
						href="#" class=""> <i class="icon-file-text"></i> <span
							style="padding-left: 5px">{{module.NAME}}</span> <span
							class="arrow"></span>
					</a>
						<ul class="sub" id="a{{module.MODULEID}}Child">
							<li class="{{module2.MODULEID}}" ng-click="moduleClick(module2)"
								ng-repeat="module2 in modules2"
								ng-if="module2.M_PARENT == module.MODULEID"><a class="" 
								href="" >{{module2.NAME}}</a></li>
						</ul></li>
				</ul>
				<!-- sidebar menu end-->
			</div>
		</aside>
		<!--sidebar end-->
		<div id="sidenav-overlay" class=""></div>
		<section id="container" class="">
			<aside class="aside-width"></aside>
			<!--main content start-->
			<!--展示首页-->
			<section id="main-content">
				<section class="wrapper" ng-show="displayMain">
					<div
						style="margin-top: 20px; margin-bottom: 20px; float: left; width: 40%; color: #2C3E50;font-size:16px">
						<h4>欢迎进入数据库系统概论实验评分系统！</h4>
						<br> <br> <br>
						在本系统中，你需要对特定实际系统中的数据库进行各种操作，从而完成本次实验。 <br> <br>
						例如，数据库包括三张数据表，表结构如下所示，你可能需要用到它们： <br>
						学生表：Student(Sno,Sname,Ssex,Sage,Sdept) <br>
						课程表：Course(Cno,Cname,Cpno,Ccredit) <br>
						学生选课表：SC(Sno,Cno,Grade) <br> 注：性别为enum('男'or'女') <br> <br>
						下面就点击具体实验章节开始吧！
					</div>
					<div style="float: left; width: 45%; margin-top: 20px">
						<img src="/rucdbcourse/views/images/ZZH.png" />
					</div>



				</section>
				<style>
#login_click {
	margin-top: 32px;
	height: 30px;
}

#login_click a {
	text-decoration: none;
	background: #01B468;
	color: #f2f2f2;
	padding: 10px 30px 10px 30px;
	font-size: 16px;
	font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif;
	font-weight: bold;
	-webkit-transition: all linear 0.30s;
	-moz-transition: all linear 0.30s;
	transition: all linear 0.30s;
}

#login_click a:hover {
	background: #02DF82;
}

#lt_click {
	margin-top: 32px;
	height: 30px;
}

#lt_click a {
	text-decoration: none;
	background: #01B468;
	color: #f2f200;
	padding: 10px 30px 10px 30px;
	font-size: 16px;
	font-family: 微软雅黑, 宋体, Arial, Helvetica, Verdana, sans-serif;
	font-weight: bold;
	-webkit-transition: all linear 0.30s;
	-moz-transition: all linear 0.30s;
	transition: all linear 0.30s;
	width: 100%;
	height: 100%;
}

#lt_click a:hover {
	background: #02DF82;
}

textarea {
	width: 100%;
	height: 100%;
}

input {
	width: 100%;
	height: 100%;
}
</style>
				<section class="wrapper" ng-show="displayfeedbackLT">
					<div
						style="margin-top: 20px; margin-bottom: 20px; float: left; width: 40%; color: #2C3E50">
						<h4>互动起来吧！</h4>

						<div id="login_click">
							<a id="btlogin" href="" ng-click="feedbackClick()">返回列表</a>
						</div>
						<div align="right"
							STYLE="margin: auto; padding: 10px; border: 0px; list-style: none; word-wrap: normal; word-break: normal; line-height: normal; color: rgb(70, 70, 70); background-color: rgb(201, 201, 201); font-family: 微软雅黑, arial, sans-serif; font-size: 13px;">
							<p style="float: left; font-size: 17px;font-weight:bold"">{{nowfeedback}}</P>
							{{nowfeedbacktype}}
						</div>
						<p
							STYLE="margin: auto; padding: 5px 5px; border: 5px solid rgb(201, 201, 201); list-style: none; word-wrap: normal; word-break: normal; line-height: normal; color: rgb(70, 70, 70); background-color: rgb(255, 255, 255); font-family: 微软雅黑, arial, sans-serif; font-size: 16px;">
							{{nowfeedbacktext}}</P>
						<div class="takeComment" style="">
							<div class="noComment" ng-show="feedbacklts.length==0">暂无回复</div>
							<div class="messlist">

								<div ng-repeat="feedbacklt in feedbacklts">
									<div>
										<p
											STYLE="margin: auto; padding: 5px; border: 2px solid rgb(201, 201, 201); list-style: none;; word-wrap: normal; word-break: normal; line-height: normal; color: #000000; background-color: #E8E8E8; font-family: 微软雅黑, arial, sans-serif; font-size: 16px;">
											<span style="font-weight:bold">{{feedbacklt.USERNAME}}：</span>{{feedbacklt.FEEDBACKANS}}</P>
									</div>
								</div>
							</div>

						</div>
						<div>
							<textarea name="textarea" id=""
								style="resize: none; height: 150px;" ng-model="feedbacktext2"></textarea>
							<div id="login_click">
								<a id="btlogin" href="" ng-click="feedbackltSubmit()">回复</a>
							</div>
						</div>
					</div>

					<div style="float: left; width: 45%; margin-top: 20px">
						<img src="/rucdbcourse/views/images/ZZH.png" />
					</div>



				</section>


				<section class="wrapper" ng-show="displayFeedback">
					<div
						style="margin-top: 20px; margin-bottom: 20px; float: left; width: 40%; color: #2C3E50">
						<h4>欢迎反馈</h4>
						<br> <label for="name">选择反馈的类别:</label> <select
							ng-init="feedbacktype=activities[0]" ng-model="feedbacktype"
							class="form-control"
							ng-options="a.name group by a.type for a in activities">
						</select> <input type="text" name="input" id="" placeholder="请在这里输入标题"
							style="margin: auto; padding: 5px 5px; border: 5px solid rgb(201, 201, 201); list-style: none; word-wrap: normal; word-break: normal; line-height: normal; color: rgb(70, 70, 70); background-color: rgb(255, 255, 255); font-family: 微软雅黑, arial, sans-serif; font-size: 16px;"
							ng-model="feedbacktext"></input> <br>
						<textarea name="textarea" id="" placeholder="请在这里输入正文"
							style="resize: none; height: 150px;" ng-model="feedbackans"></textarea>
						<div id="login_click">
							<a id="btlogin" href="" ng-click="feedbackSubmit()">提 交</a>
						</div>
						<br>

						<div class="takeComment">
							<div class="noComment" ng-show="replies.length==0">暂无留言</div>
							<div class="messlist">

								<div class="reply" ng-repeat="reply in replies">
									<div>

										<div id="" align="right"
											STYLE="margin: auto; padding:10px; border: 2px solid rgb(201, 201, 201); list-style: none;; word-wrap: normal; word-break: normal; line-height: normal; color: #757575; background-color: #E8E8E8; font-family: 微软雅黑, arial, sans-serif; font-size: 12px;">
											<a id="" href="" style="float: left; font-size: 16px ;  display:inline-block;; text-align:center"
												ng-click="feedbackLT(reply.ID,reply.FEEDBACKTEXT,reply.FEEDBACKANS,reply.FEEDBACKTYPE)"><span style="font-weight:bold">{{reply.USERNAME}}：</span>{{reply.FEEDBACKTEXT}}
											</a>{{reply.FEEDBACKTYPE}}
										</div>

									</div>
								</div>
							</div>

						</div>

					</div>
					<div style="float: left; width: 45%; margin-top: 20px">
						<img src="/rucdbcourse/views/images/ZZH.png" />
					</div>

				</section>
				<!--展示题目-->
				<section class="wrapper" ng-show="displayModule">
					<div
						style="margin-top: 20px; margin-left: 10%; margin-bottom: 20px; float: left">
						<h3>{{moduleName}}</h3>
					</div>
					<div style="margin-top: 20px; margin-left: 35%; color: #2C3E50; font-size: 16px"
						id='sceneInfoDiv'>
						<!-- 学生表：Student(Sno,Sname,Ssex,Sage,Sdept) <br> 
                        课程表：Course(Cno,Cname,Cpno,Ccredit) <br> 
                        学生选课表：SC(Sno,Cno,Grade) <br> 
                        注：性别为enum('男'or'女') <br> -->
						<!-- {{sceneInfo}} -->
					</div>
					<div style="font-size: 16px" id="msform" name='DataForm' method='post' action="" >
						<!-- progressbar -->
						<ul id="progressbar">
							<li ng-repeat="expModule in expModules">第{{expModule.num}}题</li>
						</ul>
						<fieldset ng-repeat="expModule in expModules">
							<h2 class="fs-title">{{$index + 1}}. {{expModule.EDESC}}</h2>
							<textarea ng-if="expModule.eStatus!=1"
								name="SQL{{expModule.EXPID}}" id="SQL{{expModule.EXPID}}"
								style="height: 150px" ng-model="expModule.userSolution"></textarea>
							<h2 class="fs-subtitle" ng-if="expModule.eStatus==1">你的答案：{{expModule.userSolution}}</h2>
							<h3 class="fs-subtitle"
								ng-if="expModule.eStatus==1&&expModule.errorData==1">
								<i class="icon-ok icon-4x"></i>正确——{{expModule.score}}分
							</h3>
							<h3 class="fs-subtitle"
								ng-if="expModule.eStatus==1&&expModule.errorData==0">
								<i class="icon-remove icon-4x"></i>错误——{{expModule.score}}分
							</h3>
							<h3 class="fs-subtitle"
								ng-if="expModule.eStatus==1&&expModule.errorData==2">
								<i class="icon-circle-blank icon-4x "></i>不完全正确，请检查——{{expModule.score}}分
							</h3>
							<input type="button" ng-if="$index!=0" name="previous"
								class="previous action-button" value="上一题" /> <input
								type="button" ng-if="$index!=count-1" name="next"
								class="next action-button" value="下一题" />
							<!-- <input type="submit" ng-if="$index==count-1" name="submit" class="action-button" value="提交" ng-click="submit()" /> -->
							<!-- <span ng-if="$index==count-1&&expModule.eStatus!=1" name="submit" class="action-button" value="提交" ng-click="submit()">&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;</span>
                        	 -->
							<button ng-if="$index==count-1&&expModule.eStatus!=1"
								name="submit" class="action-button" value="提交"
								ng-click="submit()">&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;</button>
						</fieldset>
					</div>
					<button ng-if="expModules[0].eStatus!=1" style=""
						class="save-button" id="save-btn" type="button" ng-click="save()">保&nbsp;&nbsp;&nbsp;&nbsp;存</button>
				</section>
				<!--main content end-->
			</section>
	</div>
	<script type="text/javascript" src="/rucdbcourse/views/js/jquery.js"></script>
	<script src="/rucdbcourse/views/js/jquery.cookie.js"></script>
	<script type="text/javascript"
		src="/rucdbcourse/views/lib/angular.min.js"></script>
	<script type="text/javascript"
		src="/rucdbcourse/views/js/loading-bar.js"></script>
	<script src="/rucdbcourse/views/js/jquery.easing.min.js"
		type="text/javascript"></script>
	<script src="/rucdbcourse/views/js/zzsc.js" type="text/javascript"></script>
	<!-- js placed at the end of the document so the pages load faster -->
	<script src="/rucdbcourse/views/js/bootstrap.min.js"></script>
	<script src="/rucdbcourse/views/js/jquery.scrollTo.min.js"></script>
	<script src="/rucdbcourse/views/js/jquery.nicescroll.js"
		type="text/javascript"></script>
	<script src="/rucdbcourse/views/js/jquery-ui-1.9.2.custom.min.js"></script>
	<!--custom switch-->
	<script src="/rucdbcourse/views/js/bootstrap-switch.js"></script>
	<!--custom tagsinput-->
	<script src="/rucdbcourse/views/js/jquery.tagsinput.js"></script>
	<!--custom checkbox & radio-->
	<script type="text/javascript" src="/rucdbcourse/views/js/ga.js"></script>
	<!--common script for all pages-->
	<script src="/rucdbcourse/views/js/common-scripts.js"></script>
	<script src="/rucdbcourse/views/js/sidebar.js"></script>
	<script type="text/javascript"
		src="/rucdbcourse/views/js/num2Chinese.js"></script>
	<script src="/rucdbcourse/views/assets/layer/layer.js"></script>

	<!--script for this page-->
	<script type="text/javascript">
		// base64加密开始  
		var keyStr = "ABCDEFGHIJKLMNOP" + "QRSTUVWXYZabcdef"
				+ "ghijklmnopqrstuv" + "wxyz0123456789+/" + "=";

		function encode64(input) {

			var output = "";
			var chr1, chr2, chr3 = "";
			var enc1, enc2, enc3, enc4 = "";
			var i = 0;
			do {
				chr1 = input.charCodeAt(i++);
				chr2 = input.charCodeAt(i++);
				chr3 = input.charCodeAt(i++);
				enc1 = chr1 >> 2;
				enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
				enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
				enc4 = chr3 & 63;
				if (isNaN(chr2)) {
					enc3 = enc4 = 64;
				} else if (isNaN(chr3)) {
					enc4 = 64;
				}
				output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2)
						+ keyStr.charAt(enc3) + keyStr.charAt(enc4);
				chr1 = chr2 = chr3 = "";
				enc1 = enc2 = enc3 = enc4 = "";
			} while (i < input.length);

			return output;
		}
		// base64加密结束 
		function utf16to8(str) {
			if (!str)
				str = " ";
			var out, i, len, c;
			out = "";
			len = str.length;
			for (i = 0; i < len; i++) {
				c = str.charCodeAt(i);
				if ((c >= 0x0001) && (c <= 0x007F)) {
					out += str.charAt(i);
				} else if (c > 0x07FF) {
					out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
					out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
					out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
				} else {
					out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
					out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
				}
			}
			return out;
		}

		function utf8to16(str) {

			var out, i, len, c;
			var char2, char3;
			out = "";
			len = str.length;
			i = 0;
			while (i < len) {
				c = str.charCodeAt(i++);
				switch (c >> 4) {
				case 0:
				case 1:
				case 2:
				case 3:
				case 4:
				case 5:
				case 6:
				case 7:
					// 0xxxxxxx
					out += str.charAt(i - 1);
					break;
				case 12:
				case 13:
					// 110x xxxx 10xx xxxx
					char2 = str.charCodeAt(i++);
					out += String.fromCharCode(((c & 0x1F) << 6)
							| (char2 & 0x3F));
					break;
				case 14:
					// 1110 xxxx 10xx xxxx 10xx xxxx
					char2 = str.charCodeAt(i++);
					char3 = str.charCodeAt(i++);
					out += String.fromCharCode(((c & 0x0F) << 12)
							| ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));
					break;
				}
			}
			return out;
		}
	</script>

	<script type="text/javascript">
		function test() {
			var second = 0;
			window.setInterval(function() {
				second++;
			}, 1000);
			var tjArr = localStorage.getItem("jsArr") ? localStorage
					.getItem("jsArr") : '[{}]';
			$.cookie('tjRefer', getReferrer(), {
				expires : 1,
				path : '/'
			});
			if ($.cookie('tjRefer') == '') {
				var tjT = eval('(' + localStorage.getItem("jsArr") + ')');
				if (tjT) {
					tjT[tjT.length - 1].time += second;
					var jsArr = JSON.stringify(tjT);
					localStorage.setItem("jsArr", jsArr);
				}
			} else {
				var tjArr = localStorage.getItem("jsArr") ? localStorage
						.getItem("jsArr") : '[{}]';
				var dataArr = {
					'url' : location.href,
					'time' : second,
					'refer' : getReferrer(),
					'timeIn' : Date.parse(new Date()),
					'timeOut' : Date.parse(new Date()) + (second * 1000)
				};
				tjArr = eval('(' + tjArr + ')');
				tjArr.push(dataArr);
				tjArr = JSON.stringify(tjArr);
				localStorage.setItem("jsArr", tjArr);
			}
			console.log(tjArr);
		}

		var app = angular.module('index', [ 'chieffancypants.loadingBar' ])
				.config(function(cfpLoadingBarProvider) {
					cfpLoadingBarProvider.includeSpinner = true;
				});
		app
				.controller(
						'indexCtrl',
						function($scope, $http, $timeout, cfpLoadingBar) {

							cfpLoadingBar.start();
							$scope.fakeIntro = true;
							$timeout(function() {
								cfpLoadingBar.complete();
								$scope.fakeIntro = false;
							}, 750);
							//判断有没有登陆过
							$http({
								method : 'GET',
								url : '../user/getSession'
							}).then(function(response) {
								// debugger
								// console.log(response)
								if (response.data.value == 'nlogin') {
									window.location = "/rucdbcourse/";
								} else {
									$scope.userName = response.data.value
								}
							}, function(error) {
								console.log(error)
							});

							//刚打开的时候展示首页  屏蔽题目信息
							$scope.displayModule = false;
							$scope.displayMain = true;
							$scope.displayFeedback = false;
							$scope.displayfeedbackLT = false;
							$scope.solutions = [];
							$scope.index = 0;
							$http({
								method : 'GET',
								url : '../module/getModules'
							}).then(function(response) {
								// debugger
								// console.log(response)
								$scope.modules = response.data;
								$scope.modules2 = response.data;
							}, function(error) {
								console.log(error)
							});
							$scope.feedbackClick = function() {
								$scope.displayMain = false;
								$scope.displayModule = false;
								$scope.displayFeedback = true;
								$scope.displayfeedbackLT = false;
							};

							$scope.moduleClick = function(module) {
								//alert($scope.constmoduleid);
								if($scope.constmoduleid==0)$scope.constmoduleid=module.MODULEID;
								$http({
									url : '/rucdbcourse/tracker/moduleTrack',
									method : 'GET',
									params : {
										moduleId : module.MODULEID,
										constmoduleId : $scope.constmoduleid,
										actionId : 1
									}
								}).then(function(response) {

								}, function(error) {
									console.log(error)
								});
								$scope.constmoduleid=module.MODULEID;
								//用来显示题目数字的配置
								var count = 0;
								//显示module题目信息
								$scope.displayMain = false;
								$scope.displayModule = true;
								$scope.displayFeedback = false;
								$scope.displayfeedbackLT = false;
								$scope.moduleName = module.NAME;

								// console.log('----' + module.MODULEID + '----');
								$http({
									method : 'GET',
									url : '../module/getModuleDetails',
									params : {
										moduleId : module.MODULEID
									}
								})
										.then(
												function(response) {
													//debugger
													// console.log(response)
													$scope.expModules = response.data;
													//用来显示1 2 3的题目
													count = response.data.length;
													$scope.count = count;
													$("#sceneInfoDiv").empty();
													$http(
															{
																method : 'GET',
																url : '../module/getSceneInfo',
																params : {
																	moduleId : module.MODULEID
																}
															})
															.then(
																	function(response) {

																		if (response.data.length != 0) {
																			var sceneInfo = response.data[0].SDESC;
																			$("#sceneInfoDiv").append(sceneInfo);
																		} else {
																			layer.msg('老师还未出题，请等待老师出题后再作答',{icon : 2});
																		}

																	},
																	function(error) {
																		console.log(error)
																	})
															.then(function(){
																//每次进入新的模块重置paperId
																//下次改到更前面
																$scope.modulePaperId = '';
																$http(
																		{
																			url : '../module/getPaperId',
																			method : 'GET',
																			params : {
																				moduleId : module.MODULEID
																			}
																		}).then(function(response){
																//gyh note:
																//debugger
																			console.log("----------");
																			console.log(response.data);
																			$scope.modulePaperId = response.data.value;
																			console.log($scope.modulePaperId);
																		}).then(
																											function(
																													response) {
																												getUserExpStatusByPaperAjax($scope.modulePaperId);










																											},
																											function(
																													error) {
																												console
																														.log(error)
																											});								



															});

												function getUserExpStatusByPaperAjax(paperIdentifier)	
												{	//alert($scope.modulePaperId);
													//原：获取该module的题是否回答过
													//现在：获取该paper的题是否回答过
													$http(
															{
																method : 'GET',
																url : '../user/getUserExpStatusByPaper',															
																params : {
																	paperId : paperIdentifier//$scope.modulePaperId
																}
															})
															.then(
																	function(
																			response) {
																		//debugger
																		// console.log(response.data);
																		var userModules = [];
																		userModules = response.data;
																		var isAnswered = userModules.length; //0 没答过
																		//alert(isAnswered);
																		if (isAnswered != 0) { //如果已经回答过
																			for (var i = 0; i < $scope.expModules.length; i++) {
																				$scope.expModules[i].num = new change(
																						(i + 1)
																								.toString())
																						.pri_ary();
																				$scope.expModules[i].userSolution = userModules[i].SOLUTION;
																				$scope.expModules[i].errorData = userModules[i].ERRDATA;
																				//debugger
																				$scope.expModules[i].eStatus = userModules[i].ESTATUS;
																				$scope.expModules[i].score = parseInt(userModules[i].SCORE);
																			}
																			;
																		} else {
																			for (var i = 0; i < $scope.expModules.length; i++) {
																				$scope.expModules[i].num = new change(
																						(i + 1)
																								.toString())
																						.pri_ary();
																			}
																			;
																		}
																		// console.log(response)
																		/*******************样式填充******************/
																		var temp = 1 / count - 0.0001;
																		var width = (Math
																				.round(temp * 10000) / 100)
																				.toFixed(2)
																				+ '%';
																		$(
																				"#progressbar li")
																				.css(
																						"width",
																						width);
																		$(
																				"#sidebar .active")
																				.removeClass(
																						"active");
																		$(
																				"#progressbar li:first")
																				.addClass(
																						"active")
																		var flag = $(
																				"."
																						+ module.MODULEID)
																				.parent()
																				.attr(
																						"class");
																		if (flag == "sub") {
																			$(
																					"."
																							+ module.MODULEID)
																					.parent()
																					.parent()
																					.addClass(
																							"active");
																		}
																		$("."+ module.MODULEID).addClass("active");
																		$(".next").click(function() {
																							var questionId = $(this)
																									.parent().next()
																									.children("h2").text()
																									.substring(0,1);
																							//alert(questionId);
																							$http(
																									{
																										url : '/rucdbcourse/tracker/questionTrack',
																										method : 'GET',
																										params : {
																											moduleId : module.MODULEID,
																											questionId : questionId,
																											actionId : 2
																										}
																									})
																									.then(function(response) {
																											},
																											function(error) {
																												console.log(error)
																											});
																							if (animating)
																								return false;
																							animating = true;
																							current_fs = $(this).parent();
																							next_fs = $(this).parent().next();
																							//activate next step on progressbar using the index of next_fs
																							$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
																							//show the next fieldset
																							next_fs.show();
																							//hide the current fieldset with style
																							current_fs.animate(
																											{
																												opacity : 0
																											},
																											{
																												step : function(now,mx) {
																													//as the opacity of current_fs reduces to 0 - stored in "now"
																													//1. scale current_fs down to 80%
																													scale = 1 - (1 - now) * 0.2;
																													//2. bring next_fs from the right(50%)
																													left = (now * 50)+ "%";
																													//3. increase opacity of next_fs to 1 as it moves in
																													opacity = 1 - now;
																													current_fs.css({
																																'transform' : 'scale('+ scale+ ')'
																															});
																													next_fs.css({
																																'left' : left,
																																'opacity' : opacity
																															});
																												},
																												duration : 800,
																												complete : function() {
																													current_fs.hide();
																													animating = false;
																												},
																												//this comes from the custom easing plugin
																												easing : 'easeInOutBack'
																											});
																						});

																		$(".previous").click(function() {
																							var questionId = $(
																									this)
																									.parent()
																									.prev()
																									.children("h2")
																									.text()
																									.substring(0,1);
																							$http(
																									{
																										url : '/rucdbcourse/tracker/questionTrack',
																										method : 'GET',
																										params : {
																											moduleId : module.MODULEID,
																											questionId : questionId,
																											actionId : 3

																										}
																									})
																									.then(function(response) {

																											},
																											function(error) {
																												console.log(error)
																											});

																							if (animating)
																								return false;
																							animating = true;
																							current_fs = $(
																									this)
																									.parent();
																							previous_fs = $(
																									this)
																									.parent()
																									.prev();
																							//de-activate current step on progressbar
																							$("#progressbar li")
																									.eq($("fieldset").index(current_fs))
																									.removeClass("active");
																							//show the previous fieldset
																							previous_fs.show();
																							//hide the current fieldset with style
																							current_fs
																									.animate(
																											{
																												opacity : 0
																											},
																											{
																												step : function(
																														now,
																														mx) {
																													//as the opacity of current_fs reduces to 0 - stored in "now"
																													//1. scale previous_fs from 80% to 100%
																													scale = 0.8 + (1 - now) * 0.2;
																													//2. take current_fs to the right(50%) - from 0%
																													left = ((1 - now) * 50)
																															+ "%";
																													//3. increase opacity of previous_fs to 1 as it moves in
																													opacity = 1 - now;
																													current_fs
																															.css({
																																'left' : left
																															});
																													previous_fs
																															.css({
																																'transform' : 'scale('
																																		+ scale
																																		+ ')',
																																'opacity' : opacity
																															});
																												},
																												duration : 800,
																												complete : function() {
																													current_fs
																															.hide();
																													animating = false;
																												},
																												//this comes from the custom easing plugin
																												easing : 'easeInOutBack'
																											});
																						});
																		/*******************样式填充结束******************/
																	},
																	function(error) {
																		console.log(error)
																	});
											};
												}, function(error) {
													console.log(error)
												});
										
							};
							//////...................................

							$scope.activities = [ {
								id : 1,
								type : "数据操纵语言",
								name : "单表查询"
							}, {
								id : 2,
								type : "数据操纵语言",
								name : "多表查询"
							}, {
								id : 3,
								type : "数据操纵语言",
								name : "数据更新"
							}, {
								id : 4,
								type : "数据定义语言",
								name : "表的定义、修改与删除"
							}, {
								id : 5,
								type : "数据定义语言",
								name : "索引级建立与删除"
							}, {
								id : 6,
								type : "数据定义语言",
								name : "视图的建立与删除"
							}, {
								id : 7,
								type : "数据定义语言",
								name : "实体完整性"
							}, {
								id : 8,
								type : "数据定义语言",
								name : "参照完整性"
							}, {
								id : 9,
								type : "数据控制语言",
								name : "授权与回收"
							}, {
								id : 10,
								type : "数据库编程",
								name : "触发器设置"
							}, {
								id : 11,
								type : "数据库编程",
								name : "存储过程"
							}, {
								id : 12,
								type : "数据库恢复",
								name : "数据库恢复"
							}, ];
							$scope.replies = []
							//显示留言
							$scope.feedbacklts = []
							$http({
								url : '../module/dealFeedback2',
								method : 'GET',

							}).success(function(response) {

								$scope.replies = response;

							}).error(function() {
								alert('读取失败.....');
							});

							//提交留言
							$scope.feedbacktype = null;
							$scope.feedbacktext = null;
							$scope.feedbackans=null;
							$scope.feedbacktext2=null;
							$scope.feedbackltSubmit = function() {
								console.log($scope.feedbacktext2)
								console.log($scope.feedbackLTid)
								if ($scope.feedbacktext2==null||$scope.feedbacktext2.replace(
										/(^s*)|(s*$)/g, "").length == 0) {
									layer.msg("回复不能为空！");
								} else {
									$http(
											{
												url : '../module/dealFeedbackltstu',
												method : 'POST',
												data : $
														.param({
															'message' : $scope.feedbacktext2,
															'id' : $scope.feedbackLTid
														}),
												headers : {
													'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8'
												},
											})
											.success(
													function(response) {
														layer.msg("回复成功！");
														$scope.feedbacktext2 = '';
														$scope.feedbacklts
																.push(response);
													},
													function(error) {
														console.log(error)
														layer.msg("提交失败", {
															icon : 0
														})
														$(
																"button[name='submit']")
																.text('提交');
														$(
																"button[name='submit']")
																.removeAttr(
																		'disabled');
													});
								}
							};
							$scope.feedbackSubmit = function() {
								console.log($scope.feedbacktext)
								console.log($scope.feedbacktype)
								console.log($scope.feedbackans)
								if ($scope.feedbacktext==null||$scope.feedbacktext.replace(/(^s*)|(s*$)/g,
										"").length == 0) {
									layer.msg("标题不能为空！");
								} else if ($scope.feedbackans==null||$scope.feedbackans.replace(
										/(^s*)|(s*$)/g, "").length == 0) {
									layer.msg("内容不能为空！");
								} else {
									$http(
											{
												url : '../module/dealFeedback',
												method : 'POST',
												data : $
														.param({
															'message' : $scope.feedbacktext,
															'text' : $scope.feedbackans,
															'type' : $scope.feedbacktype.name
														}),
												headers : {
													'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8'
												},
											})
											.success(
													function(response) {
														layer.msg("提交成功！");
														$scope.replies
																.unshift(response);
														$scope.feedbacktext = '';
														$scope.feedbackans = '';
													},
													function(error) {
														console.log(error)
														layer.msg("提交失败", {
															icon : 0
														})
														$(
																"button[name='submit']")
																.text('提交');
														$(
																"button[name='submit']")
																.removeAttr(
																		'disabled');
													});
								}
							};
							$scope.nowfeedback = null;
							$scope.nowfeedbacktext = null;
							$scope.feedbackLTid = null;
							$scope.feedbackLT = function(a, text, text2, type) {
								$scope.feedbacklts = [];
								$scope.displayfeedbackLT = true;
								$scope.displayModule = false;
								$scope.displayMain = false;
								$scope.displayFeedback = false;
								$scope.feedbackLTid = a;
								$scope.nowfeedback = text;
								$scope.nowfeedbacktype = type;
								$scope.nowfeedbacktext = text2;
								console.log($scope.feedbackLTid)
								console.log($scope.nowfeedback)
								$http(
										{
											url : '../module/dealFeedbacklt',
											method : 'POST',
											data : $.param({
												'id' : a,

											}),
											headers : {
												'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8'
											},
										}).success(
										function(response) {
											$scope.feedbacklts = response;
										},
										function(error) {
											console.log(error)
											layer.msg("读取失败", {
												icon : 0
											})
											$("button[name='submit']").text(
													'提交');
											$("button[name='submit']")
													.removeAttr('disabled');
										});
							};
							//获取到该行的答案 作为userSolution存储
							$scope.submit = function() {
								// console.log($scope.expModules)
								var tempExpModules = []
								for (var i = 0; i < $scope.expModules.length; i++) {
									var tempExpModule = {}
									tempExpModule.userSolution = encode64(utf16to8($scope.expModules[i].userSolution))
									// tempExpModule.userSolution = $scope.expModules[i].userSolution
									// console.log(tempExpModule.userSolution)
									tempExpModule.MODULEID = $scope.expModules[i].MODULEID
									tempExpModule.EXPID = $scope.expModules[i].EXPID
									tempExpModule.EXTRA = encode64(utf16to8($scope.expModules[i].EXTRA))
									tempExpModule.SOLUTION = encode64(utf16to8($scope.expModules[i].SOLUTION))
									tempExpModule.BEFOREMODULEID =$scope.expModules[i].BEFOREMODULEID
									tempExpModule.BEFOREEXPID =$scope.expModules[i].BEFOREEXPID
									console.log(tempExpModule.BEFOREMODULEID)
									console.log(tempExpModule.BEFOREEXPID)
									tempExpModules.push(tempExpModule)
								}
								// console.log(tempExpModules)

								layer.confirm(
												'确认提交您的答案？',
												{
													title : false,
													closeBtn : 0,
													btnAlign : 'c',
													skin : 'layui-layer-molv',
													btn : [ '确认', '取消' ]
												//按钮
												},
												function() {
													cfpLoadingBar.start();
													$("button[name='submit']").text('提交中...');
													$("button[name='submit']").attr('disabled','disabled');
													var index = layer
															.open({
																type : 1,
																title : false,
																closeBtn : false,
																content : '正在提交您的答案，请不要关闭当前页面...',
																area : [
																		'200px',
																		'100px' ]
															})
													var submitid = $scope.expModules.length + 1;
													$http(
															{
																url : '/rucdbcourse/tracker/questionTrack',
																method : 'GET',
																params : {
																	moduleId : $scope.expModules[0].MODULEID,
																	questionId : submitid,
																	actionId : 4
																}
															})
															.then(function(response) {
																	},
																	function(error) {
																		console.log(error)
																	});
													//alert("testtest");
													$http(
															{
																url : '../module/judgetUserModuleSolutions',
																method : 'POST',
																data : $.param({
																			'message' : JSON.stringify(tempExpModules),
																			'paperId' : $scope.modulePaperId
																		}),
																/*
																method : 'GET',
																params : {
																	'message' : JSON
																					.stringify(tempExpModules),
																	'paperId' : $scope.modulePaperId

																},*/

																headers : {
																	'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8'
																},
															})
															.success(
																	function(response) {
																		layer.close(index);
																		layer.msg("你的得分是："+ response.value+ '分')
																		window.setTimeout("window.location = '/rucdbcourse/views/index.html'",1000);
																		//window.location = "/rucdbcourse/views/index.html"
																	},
																	function(
																			error) {
																		console.log(error)
																		cfpLoadingBar.complete();
																		layer.msg("提交失败",
																						{
																							icon : 0
																						})
																		$(
																				"button[name='submit']").text('提交');
																		$(
																				"button[name='submit']").removeAttr('disabled');

																	});
												}, function() {
													//取消
												});
							};

							$scope.logout = function() {
								//退出登录
								$http({
									method : 'GET',
									url : '../user/logout'
								}).then(function(response) {
									//debugger
									// console.log(response)
								}, function(error) {
									console.log(error)
								});
							};

							//保存用户答案
							$scope.save = function() {
								cfpLoadingBar.start();
								var tempExpModules = []
								for (var i = 0; i < $scope.expModules.length; i++) {
									var tempExpModule = {}
									tempExpModule.userSolution = encode64(utf16to8($scope.expModules[i].userSolution))
									tempExpModule.MODULEID = $scope.expModules[i].MODULEID
									tempExpModule.EXPID = $scope.expModules[i].EXPID
									tempExpModules.push(tempExpModule)
								}
								// console.log(tempExpModules)
								$http(
										{
											url : '../module/saveUserModuleSolutions',
											method : 'POST',
											data : $
													.param({
														'message' : JSON
																.stringify(tempExpModules),
														'paperId' : $scope.modulePaperId
													}),
											headers : {
												'Content-Type' : 'application/x-www-form-urlencoded;charset=utf-8'
											},
										}).success(function(response) {
									if (response.value == "save success") {
										cfpLoadingBar.complete();
										layer.msg("保存成功", {
											icon : 1
										});
									}
								});
							};
						});
	</script>
</body>

</html>
